﻿using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Serilog;

namespace AbpProjectTemplate.Web.Startup
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateHostBuilder(string[] args)
        {
            return WebHost.CreateDefaultBuilder(args)
                          .ConfigureLogging((context, builder) =>
                          {
                              builder.ClearProviders();
                              Log.Logger = new LoggerConfiguration()
                                    .ReadFrom.Configuration(context.Configuration)
                                    .Enrich.FromLogContext()
                                    .CreateLogger();
                              //builder.AddSerilog(Log.Logger);
                          })
                          .UseStartup<Startup>();
        }
    }
}

